<template>
    <el-main>
        <!--   -->
        <el-form :model="params" ref="deptForm" :rules="rules" label-width="80px" :inline="false" size="normal">
            <el-form-item label="">
                <el-input v-model="params.searchName"></el-input>
            </el-form-item>
            <el-form-item>
                    <el-button icon="el-icon-search">查询</el-button>
                    <el-button icon="el-icon-close">重置</el-button>
            </el-form-item>
        </el-form>
        <!-- 打印表单 -->
        <el-table
        :data="tableList"
        row-key="id"
        default-expand-all
        :tree-props="{ children: 'children' }"
        border
        stripe
        >
            <el-table-column prop="name" label="部门名称"></el-table-column>
            <el-table-column prop="parentName" label="上级部门"></el-table-column>
            <el-table-column prop="deptCode" label="部门编码"></el-table-column>
            <el-table-column prop="deptPhone" label="部门电话"></el-table-column>
            <el-table-column prop="deptAddress" label="部门地址"></el-table-column>
        </el-table>
        <!-- 新增部门弹框 -->

        
    </el-main>
</template>
<script>
import {getDeptListApi} from '@/api/department'
export default {
    data() {
        return {
            //存储部门列表数据
            tableList: [],
            //存储搜索关键字数据域
            params: {
                searchName: "",
            }
        }
    },
    created(){
        this.getDeptList()
    },
    methods:{
        async getDeptList(){
            let res = await getDeptListApi(this.params)
            this.tableList = res.data
            const {children} = res.data[0]
            console.log(children)
        }
    }
}
</script>
<style lang="scss">

</style>